﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
if sid="Null" then
Response.Redirect "/login.asp?sid="&sidd&"&url=/game/suoha/index.asp"
else
IF  Request.QueryString("Action")="login" Then
	call loginn
else
	call index
end if
end if
end Function
Function index

        dim pid,mon,body,id,act,mynid
	id=Request.QueryString("id")
	if id="" then id=1
	if not isnumeric(id) then id=1
	id=clng(id)
	pid=Request.QueryString("pid")
	if pid="" then pid=1
	if not isnumeric(pid) then pid=1
	pid=clng(pid)
	act=Request.QueryString("act")
	if act="" then act=0
	if not isnumeric(act) then act=0
	act=clng(act)
        if act<>1 and act<>2 and act<>0 then act=0
        mon=sangong.namejian("money",pid)
        mynid=qingtian.nid
select case v
case "0"
we0="<br/>"
hr="----------------<br/>"
%>
<card id="main" title="热血梭哈"><p align="<%=qingtian.px%>">
<%
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
%>
<title>热血梭哈</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
if sangong.namere("aid",mynid)<>0 and sangong.namere("aid",mynid)<>id and sangong.namere("bid",mynid)>4 then
qingtian.err("你还在游戏中<a href='gamedd.asp?Action=login&amp;pid="&sangong.namere("bid",mynid)&"&amp;id="&sangong.namere("aid",mynid)&"&amp;sid=" & sidd & "'>返回继续游戏</a>")
end if 
if sangong.namere("aid",mynid)<>0 and sangong.namere("aid",mynid)<>id and sangong.namere("bid",mynid)<5 then
qingtian.err("你还在游戏中<a href='gamed.asp?Action=login&amp;pid="&sangong.namere("bid",mynid)&"&amp;id="&sangong.namere("aid",mynid)&"&amp;sid=" & sidd & "'>返回继续游戏</a>")
end if
if (sangong.mobe(id)=6 and sangong.namere("ton",mynid)=0) or (sangong.namefa("ton",id)=1 and sangong.namere("ton",mynid)=0)  then
qingtian.err("该卓游戏已满6人<a href='fangd.asp?id="&pid&"&amp;sid=" & sidd & "'>返回上级</a>")
end if
sangong.pd(sangong.namefa("pid",id))
%>
<%=dao%><a href='fangd.asp?id=<%=pid%>&amp;sid=<%=sidd%>'>房间</a>|<a href='main.asp?sid=<%=sidd%>'>玩法</a>|<a href='new.asp?sid=<%=sidd%>'>排行</a>|<a href='gamed.asp?act=4&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;Action=login&amp;sid=<%=sidd%>'>退出</a><%=we0%><%=we%>
【等待玩家】<a href='gamed.asp?pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>刷新</a><br/><%=hr%>
<% if act=0 then%>
庄家<%=sangong.moname3(id,pid)%><br/>闲家<%=sangong.moname2(id,pid)%><%=we0%><%=hr%> 
<%elseif act=1 then
if conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")>6*mon then
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where aid="&id&" and ton=2 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof  then  
	Set Rss = Server.CreateObject("Adodb.Recordset")
	Sqls = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by nid asc"
	Rss.Open Sqls,cn,1,3
		if not (rss.bof and rss.eof)  then 
                rss("ton")=2
                rss("aid")=id
                rss("bid")=pid
                rss("time")=now()
                rss("ku")=1
                rss("qu")=0
	rss.update
        end if
	Rss.close
       set rss=nothing
Response.Redirect "gamed.asp?pid="&pid&"&id="&id&"&Action=login&sid="&sidd&""
       else
%>
<%=we%>坐庄失败,该卓游戏已经有庄家了<a href='gamed.asp?act=2&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>进入闲家下注</a><%=we0%> 
<%
                end if
	Rs.close
       set rs=nothing 
else
%>
<%=we%>坐庄失败,坐庄最小需要拥有<%=qingtian.bi%><%=6*mon%><a href='gamed.asp?act=2&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>进入闲家下注</a><%=we0%> 
<%
end if
elseif act=2 then
if sangong.namere("ton",mynid)=2 then 
%>
<%=we%>坐闲失败,你已经是庄家了<a href='gamed.asp?action=login&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;sid=<%=sidd%>'>返回继续游戏</a><%=we0%> 
<%
else
Response.Redirect "gamed.asp?pid="&pid&"&id="&id&"&Action=login&sid="&sidd&""
%>
<%end if%>
<%end if%>
<%=sou%>帐户:<%=zi%><%=conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")%><%=zi0%><%=qingtian.bi%><%=we0%>
<%=we%><a href='gamed.asp?id=<%=id%>&amp;pid=<%=pid%>&amp;sid=<%=sidd%><%=sangong.tu%>.<a href="index.asp?sid=<%=sidd%>">热血梭哈</a><%=we0%>
<%
end Function

Function loginn
on error resume next
dim id,a,b,nid,rs,sql,i,d,rss,sqls,mynid,act,kuture
	id=Request.QueryString("id")
	if id="" then id=1
	if not isnumeric(id) then id=1
	id=clng(id)
	pid=Request.QueryString("pid")
	if pid="" then pid=1
	if not isnumeric(pid) then pid=1
	pid=clng(pid)
	act=Request.QueryString("act")
	if act="" then act=0
	if not isnumeric(act) then act=0
	act=clng(act)
mynid=qingtian.nid
select case v
case "0"
we0="<br/>"
hr="----------------<br/>"
%>
<card id="main" title="热血梭哈"><p align="<%=qingtian.px%>">
<%
case "1"
zi="<span style=""color:#FF5500"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
%>
<title>热血梭哈</title>
</head>
<body>
<!--#include virtual="/css.inc"-->
<%
End Select
qingtian.info
if Request.QueryString("act")=4 then
        if sangong.namefa("du",id)=false then
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ton")=0
                rs("time")=now()
                rs("aid")=0
                rs("bid")=0
                rs("ku")=0
                rs("a")=0
                rs("c")=""
                rs("d")=0
                rs("b")=0
                rs("h")=0
                rs("money")=0
                rs("tu")=0
                rs("au")=0
                rs("qu")=0
	rs.update
Response.Redirect "fangd.asp?sid="&sidd&"&id="&pid
        end if
	Rs.close
       set rs=nothing
else
qingtian.err("游戏正在进行中不能退出")
end if
end if
if sangong.namere("aid",mynid)<>0 and sangong.namere("aid",mynid)<>id and sangong.namere("bid",mynid)>4 then
qingtian.err("你还在游戏中<a href='gamedd.asp?Action=login&amp;pid="&sangong.namere("bid",mynid)&"&amp;id="&sangong.namere("aid",mynid)&"&amp;sid=" & sidd & "'>返回继续游戏</a>")
end if 
if sangong.namere("aid",mynid)<>0 and sangong.namere("aid",mynid)<>id and sangong.namere("bid",mynid)<5 then
qingtian.err("你还在游戏中<a href='gamed.asp?Action=login&amp;pid="&sangong.namere("bid",mynid)&"&amp;id="&sangong.namere("aid",mynid)&"&amp;sid=" & sidd & "'>返回继续游戏</a>")
end if
if (sangong.mobe(id)=6 and sangong.namere("ton",mynid)=0) or (sangong.namefa("ton",id)=1 and sangong.namere("ton",mynid)=0)  then
qingtian.err("该卓游戏已满6人<a href='fangd.asp?id="&pid&"&amp;sid=" & sidd & "'>返回上级</a>")
end if
sangong.pd(sangong.namefa("pid",id))
%>
<%=dao%><a href='fangd.asp?id=<%=pid%>&amp;sid=<%=sidd%>'>房间</a>|<a href='main.asp?sid=<%=sidd%>'>玩法</a>|<a href='new.asp?sid=<%=sidd%>'>排行</a>|<a href='gamed.asp?act=4&amp;pid=<%=pid%>&amp;id=<%=id%>&amp;Action=login&amp;sid=<%=sidd%>'>退出</a><%=we0%>
<%=sou%>当前玩家(<%=zi%><%=sangong.moname(id)%><%=zi0%>)<%=we0%><%=hr%><%=we%>
<%
if sangong.namefa("ton",id)<>2 then
money=sangong.namejian("money",pid)
          if sangong.namefa("du",id)=0 then 
          if sangong.namere("ton",mynid)=0 then
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ton")=1
                rs("ku")=1
                rs("qu")=0
                rs("time")=now()
                rs("aid")=id
                rs("bid")=pid
	rs.update
        end if
	Rs.close
	Sql = "select top 1 * FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("time")=now()
                 rs("c")=session("username")&"进入游戏"
	rs.update 
        end if
	Rs.close
       set rs=nothing
          Response.Write("请等待5秒[<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a>]<br/>")
          else
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_reton where aid="&id&" and ton=2 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof  then  
                rssurl=true
                end if
	Rs.close
       set rs=nothing 
          if sangong.mobe(id)=1 or rssurl=true then 
          Response.Write("暂无闲家或庄家进入游戏!<br/>请等待[<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a>][<a href='gamed.asp?Act=1&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>坐庄</a>]<br/>")
          else
          if sangong.mobe(id)=6 or DATEDIFF("s", sangong.namefa("time",id), now()) > 5 then
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 * FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("time")=now()
                rs("du")=true 
                rs("ton")=1 
                rs("a")=2
	rs.update 
        end if
	Rs.close
       set rs=nothing
       sangong.game1(id)
        Response.Write("发完牌啦,牌局开始!<br/>")
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 u,a FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("u")=sangong.namere("a",sangong.suoa(id,rs("a")))
	rs.update
        end if
	Rs.close
	Sql = "select * FROM qingtian_reton where aid="&id&" order by a asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then
 		For i=1 to rs.RecordCount
                if rs("nid")=mynid then
                tt="你"
                else
                tt=qingtian.name(rs("nid"))
                end if
                if rs("nid")=mynid and sangong.suoa(id,"2")=mynid then
                body="<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=1&amp;sid="&sidd&"'>看牌</a>.<a href='gamed.asp?id="&id&"&amp;Action=login&amp;pid="&pid&"&amp;act=2&amp;sid="&sidd&"'>下注</a>.梭哈.<a href='gamed.asp?id="&id&"&amp;act=5&amp;Action=login&amp;pid="&pid&"&amp;sid="&sidd&"'>放弃</a><br/>加注|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/50)&"&amp;sid="&sidd&"'>"&int(money/50)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/25)&"&amp;sid="&sidd&"'>"&int(money/25)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/10)&"&amp;sid="&sidd&"'>"&int(money/10)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/5)&"&amp;sid="&sidd&"'>"&int(money/5)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a><br/>"
                end if 
                if rs("ton")=2 then
                pp=""&zi&"(庄)"&zi0&""
                else
                pp=""
                end if                             
                if sangong.suoa(id,"2")=rs("nid") then
                aa="下注中"
                else
                aa="等待中"
                end if
                Response.Write(""&tt&""&pp&"的牌:"&zi&""&aa&""&zi0&"[暗]<br/>")
                Response.Write(""&sangong.aapai(rs("c"),"2")&"<br/>")                            
		Rs.MoveNext
		next
                if body="" then
                Response.Write("请等待30秒[<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a>]<br/>") 
                else             
                Response.Write body 
                end if
                end if
       Rs.close
       set rs=nothing
          else
          timee=5-DATEDIFF("s", sangong.namefa("time",id), now())
          Response.Write(""&sangong.namefa("c",id)&"<br/>请等待"&timee&"秒[<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a>]<br/>")
          end if
          end if
          end if
       else
        if sangong.namefa("a",id)=6 then
        Response.Write sangong.gamejie(id,pid)
        else
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and ku=1 order by id asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then 
                if rs.RecordCount=1 then
        Response.Write sangong.gamejie(id,pid)
                end if
                end if
	Rs.close
        set rs=nothing
	midd=Request.QueryString("mon")
	if midd="" then midd=0
	if not isnumeric(midd) then midd=0
	midd=clng(midd)
        u=sangong.namefa("u",id)
        if sangong.namere("a",mynid)=u and sangong.namere("ku",mynid)=1 then
       select case act
       case "1"  
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 d FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("d")=1
	rs.update
        end if
	Rs.close
        set rs=nothing   
       case "2"
        dim ab
        sangong.time1(id)
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and qu=1 and ku=1 order by id asc"
	Rs.Open Sql,cn,1,1
		if not(rs.bof and rs.eof) then 
                midd=0
                end if
	Rs.close
        set rs=nothing 
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" order by id asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then 
                ab=rs.RecordCount
                else
                ab=0
                end if
	Rs.close
        set rs=nothing 
        if u=ab then 
        u=1
        else
        u=u+1
        end if
        b1=sangong.namefa("b",id)+midd
        b=b1
        qingtian.pay -b,mynid
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 b,h,qu FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("b")=rs("b")+b
                rs("h")=b
                rs("qu")=1
	rs.update
        end if
	Rs.close
	Sql = "select top 1 h,b,u FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("h")=rs("h")+b
                rs("b")=b1
                rs("u")=u
	rs.update
        end if
	Rs.close
        set rs=nothing
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and qu=0 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof then 
        if sangong.namefa("a",id)=5 then 
        Response.Write sangong.gamejie(id,pid)
        end if 
                end if
	Rs.close
        set rs=nothing  
       case "5"
        sangong.time1(id)
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 ku,qu,time FROM qingtian_reton where nid="&mynid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ku")=0
                rs("qu")=1
	rs.update
        end if
	Rs.close
        set rs=nothing 
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and qu=0 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof then 
        if sangong.namefa("a",id)=5 then 
        Response.Write sangong.gamejie(id,pid)
        end if 
                end if
	Rs.close
        set rs=nothing 
        End Select
        end if
        if sangong.namefa("ton",id)<>2 then
        dim tiurl,kkurl
    	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 nid,ku,time FROM qingtian_reton where aid="&id&" and a="&u&" order by id asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then 
                if DATEDIFF("s", rs("time"), now())>20 or rs("ku")=0 then
                tiurl=true
                nid=rs("nid")
                else
                tiurl=false
                nid=0
                end if
                if rs("ku")=0 then
                kkurl=true
                else
                kkurl=false
                end if
        else
        tiurl=false
        kkurl=false
        end if
	Rs.close
        set rs=nothing 
        if tiurl=true then
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" order by id asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then 
                ab=rs.RecordCount
                else
                ab=0
                end if
	Rs.close
        set rs=nothing 
        if u=ab then 
        u=1
        else
        u=u+1
        end if
        if kkurl=false then
        b=sangong.namefa("b",id)
        qingtian.pay -b,nid
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 b,h,qu,time FROM qingtian_reton where nid="&nid&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("b")=rs("b")+b
                rs("time")=now()
                rs("h")=b
                rs("qu")=1
	rs.update
        end if
	Rs.close
	Sql = "select top 1 time FROM qingtian_reton where a="&u&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("time")=now()
	rs.update
        end if
	Rs.close
	Sql = "select top 1 h,b,u FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("h")=rs("h")+b
                rs("b")=b
                rs("u")=u
	rs.update
        end if
	Rs.close
        set rs=nothing 
        else
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select top 1 u FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("u")=u
	rs.update
        end if
	Rs.close
        set rs=nothing 
        end if                
        end if 

   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and qu=0 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof then 
        if sangong.namefa("a",id)=5 then 
        Response.Write sangong.gamejie(id,pid)
        rirue=true
        end if 
                end if
	Rs.close
        set rs=nothing 

if rirue<>true then 
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and qu=0 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof then 
                ab=true
                else
                ab=false
                end if
	Rs.close
        set rs=nothing 
        if ab=true then 
        cn.Execute("update qingtian_fangd set a=a+1 where id="&id)
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select qu FROM qingtian_reton where aid="&id&" and ku=1 order by id asc"
	Rs.Open Sql,cn,1,3
		if not(rs.bof and rs.eof)  then 
 		For i=1 to rs.RecordCount
                rs("qu")=0
	        rs.update
		Rs.MoveNext
		next
        end if
	Rs.close
	Sql = "select top 1 u,a,b FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("u")=sangong.namere("a",sangong.suoa(id,rs("a")))
                rs("b")=int(money/10)
	rs.update
        end if
	Rs.close
        set rs=nothing 
        end if
        dim tau
   	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" and qu=1 and ku=1 order by id asc"
	Rs.Open Sql,cn,1,1
		if rs.bof and rs.eof then 
                tau=1
                else
                tau=0
                end if
	Rs.close
        set rs=nothing 
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" order by a desc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then
 		For i=1 to rs.RecordCount
                if rs("nid")=mynid then
                tt="你"
                if rs("d")=0 then
                kkk=sangong.aapai(rs("c"),sangong.namefa("a",id))
                kkkk="<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=1&amp;sid="&sidd&"'>看牌</a>"
                else
                kkkk="看牌"
                kkk=sangong.pai(rs("c"),sangong.namefa("a",id))
                end if 
                else
                kkk=sangong.aapai(rs("c"),sangong.namefa("a",id))
                tt=qingtian.name(rs("nid"))
                end if
                if rs("ton")=2 then
                pp=""&zi&"(庄)"&zi0&""
                else
                pp=""
                end if
                if sangong.namefa("u",id)=rs("a") and rs("ku")=1 then
                if tau=1 then
                body="发牌成功"&tt&"当前牌面最大,轮到"&tt&"下注!<br/>" 
                else
                body="轮到"&tt&"跟注啦!<br/>"
                end if
                timee=20-DATEDIFF("s", rs("time"), now())                                                      
                end if 
                if rs("ku")=0 then
                ttt="放弃本局" 
                else
                if rs("d")=0 then
                kk="[暗]"
                else 
                kk="[明]"
                end if
                if rs("qu")=1 then
                ttt="下注"&rs("h")&""  
                else
                ttt="待下注" 
                end if               
                end if                      
                body1=""&tt&""&pp&":"&zi&""&ttt&""&zi0&"(已投"&rs("b")&")"&kk&"<br/>"&kkk&"<br/>"&body1
                if rs("nid")=mynid then
                body2="当前总投注:"&zi&""&sangong.namefa("h",id)&""&zi0&"<br/>"
                end if
		Rs.MoveNext
		next
        if sangong.namefa("a",id)=5 and body="发牌成功你当前牌面最大,轮到你下注!<br/>" then
        kkkkk="<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/2)&"&amp;sid="&sidd&"'>梭哈</a>"
        else
        kkkkk="梭哈"
        end if
        Response.Write body
        Response.Write body1
        Response.Write body2
        if body="发牌成功你当前牌面最大,轮到你下注!<br/>" then
        Response.Write(""&kkkk&".<a href='gamed.asp?id="&id&"&amp;Action=login&amp;pid="&pid&"&amp;act=2&amp;sid="&sidd&"'>下注</a>."&kkkkk&".<a href='gamed.asp?id="&id&"&amp;act=5&amp;Action=login&amp;pid="&pid&"&amp;sid="&sidd&"'>放弃</a><br/>加注|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/50)&"&amp;sid="&sidd&"'>"&int(money/50)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/25)&"&amp;sid="&sidd&"'>"&int(money/25)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/10)&"&amp;sid="&sidd&"'>"&int(money/10)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;act=2&amp;mon="&int(money/5)&"&amp;sid="&sidd&"'>"&int(money/5)&"</a>|<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a><br/>")
        elseif body="轮到你跟注啦!<br/>" then
        Response.Write(""&kkkk&".<a href='gamed.asp?id="&id&"&amp;Action=login&amp;pid="&pid&"&amp;act=2&amp;sid="&sidd&"'>跟注</a>."&kkkkk&".<a href='gamed.asp?id="&id&"&amp;act=5&amp;Action=login&amp;pid="&pid&"&amp;sid="&sidd&"'>放弃</a><br/>")
        else
        Response.Write("请等待"&timee&"秒[<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a>]<br/>")
        end if
                end if
       Rs.close
       set rs=nothing

               end if    
        end if
        end if
        end if
else
        if DATEDIFF("s", sangong.namefa("time",id), now()) > 20 then
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
 		For i=1 to rs.RecordCount
                rs("ton")=0
                rs("time")=now()
                rs("aid")=0
                rs("bid")=0
                rs("ku")=0
                rs("a")=0
                rs("c")=""
                rs("d")=0
                rs("b")=0
                rs("h")=0
                rs("money")=0
                rs("au")=0
                rs("ku")=0
	        rs.update
		Rs.MoveNext
		next
        end if
	Rs.close
	Sql = "select top 1 * FROM qingtian_fangd where id="&id&" order by id asc"
	Rs.Open Sql,cn,1,3
		if not (rs.bof and rs.eof)  then 
                rs("ton")=0 
                rs("du")=0 
                rs("h")=0
                rs("u")=0
                rs("b")=0
                rs("nid")=0
	rs.update 
        end if
	Rs.close
       set rs=nothing
        Response.Write("本局游戏已经结出.<br/>是否继续游戏:<br/>1.<a href='gamed.asp?id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>继续</a><br/>2.<a href='gamed.asp?act=4&amp;Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>退出</a><br/>") 
       else
        nid=cn.execute("select nid from [qingtian_fangd] where id="&id&"")("nid")
        bodyy="恭喜,"&qingtian.name(nid)&"赢了本局游戏系统为Ta增加"&zi&""&sangong.namefa("h",id)&""&qingtian.bi&""&zi0&"!<br/>"
	Set Rs = Server.CreateObject("Adodb.Recordset")
	Sql = "select * FROM qingtian_reton where aid="&id&" order by id asc"
	Rs.Open Sql,cn,1,1
		if not (rs.bof and rs.eof)  then
 		For i=1 to rs.RecordCount
                if rs("nid")=qingtian.nid then
                tt="你的"
                else
                tt=qingtian.name(rs("nid"))
                end if
                ccccc=split(rs("c"),",")
                aa=sangong.zajinn(ccccc)
                if rs("ton")=2 then 
                pp=""&zi&"(庄)"&zi0&""
                else
                pp=""
                end if
                bodyy=bodyy&tt&"的牌"&pp&"："&zi&""&aa&""&zi0&"<br/>"&sangong.pai(rs("c"),5)&"<br/>"                          
		Rs.MoveNext
		next
                end if
       Rs.close
       set rs=nothing 
          timee=20-DATEDIFF("s", sangong.namefa("time",id), now())
          bodyy=bodyy&"请等待"&timee&"秒[<a href='gamed.asp?Action=login&amp;id="&id&"&amp;pid="&pid&"&amp;sid="&sidd&"'>刷新</a>]<br/>"
        Response.Write bodyy
        end if
end if
id=id+100007554
%>
<%=we1%><%=hr%><%=qingtian.liaotian(id)%><%=sou%>帐户:<%=zi%><%=conn.execute("select money from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"'")("money")%><%=zi0%><%=qingtian.bi%><%=we0%><%=we%><a href='gamed.asp?Action=login&amp;id=<%=id-100007554%>&amp;pid=<%=pid%>&amp;sid=<%=sidd%><%=sangong.tu%>.<a href="index.asp?sid=<%=sidd%>">热血梭哈</a><%=we0%>

<%
end function

%>